<?php
$this->headTitle('Bất động sản','append');
?>
<div class="dashboard-menu dashboard-admin">
    <span class="back">&nbsp;</span>
    <a href="/admin/estate"><h1>Bất động sản</h1></a>
    <span class="text"><?php echo $this->estateCheck['estateName'];?></span>
</div>
<div class="row placeholders">
    <div class="col-md-12">
        <div class="widget-big">
            <div class="search-result text-left">
                <?php
                    if(isset($this->mess)){
                        if($this->flag == 'success')
                            echo '<div class="bg-success">',$this->mess,'</div>';
                        elseif($this->flag == 'alert')
                            echo '<div class="bg-warning">',$this->mess,'</div>';
                        else
                            echo '<div class="bg-danger">',$this->mess,'</div>';
                    }
                ?>
                <form id="form" class="form-option" method="post" action="" enctype="multipart/form-data" name="form">
                    <dl class="zend_form">
                        <dt><label>Tên bất động sản</label></dt>
                        <dd><input type="text" id="estateName" name="estateName" value="<?php echo $this->estateCheck['estateName'];?>"/></dd>
                       
                        <dt><label>Mã chữ</label></dt>
                        <dd><input type="text" id="estateCode" name="estateCode" value="<?php echo $this->estateCheck['estateCode'];?>"/></dd>
                       
                        <dt><label>Loại giao dịch</label></dt>
                        <dd>
                            <div class="option-wrapper">
                                <div class="fieldset">
                                    <div class="legend"><input type="checkbox" id="check_all_resource_admin"/><label>Chọn hết</label></div>
                                    <div class="fieldset-content">
                                    <ul>                                    
                                    <?php
                                        if($this->estateCheck['rent'] == 1){
                                            echo "<li><input type='checkbox' name='rent' checked='checked'/><label>Thuê</label></li>";
                                        }else{
                                            echo "<li><input type='checkbox' name='rent'/><label>Thuê</label></li>";
                                        }
                                    ?>
                                    <?php
                                        if($this->estateCheck['sale'] == 1){
                                            echo "<li><input type='checkbox' name='sale' checked='checked'/><label>Bán</label></li>";
                                        }else{
                                            echo "<li><input type='checkbox' name='sale'/><label>Bán</label></li>";
                                        }
                                    ?>                                                                                                                      
                                    <div class="clearfix"></div>
                                    </ul>
                                    </div>
                                </div>
                            </div>
                        </dd>
                       
                        <dt><label>Thông tin khác</label></dt>
                        <dd>
                            <div class="option-wrapper">
                                <div class="fieldset">
                                    <div class="legend"><input type="checkbox" id="check_all_resource_admin"/><label>Chọn hết</label></div>
                                    <div class="fieldset-content">
                                    <ul>
                                    <?php                                         
                                        $otherInfoList = json_decode($this->estateCheck['otherInfo']);                                        
                                        foreach($this->infoList as $info){                                            
                                            if($info['groupInfo'] == 'otherInfo'){                                                
                                                if(isset($otherInfoList) && is_array($otherInfoList) && in_array($info['id'],$otherInfoList)){
                                                    echo "<li><input type='checkbox' class='resourceIdDefault' name='otherInfoId[]' value='{$info['id']}' checked='checked'><label>{$info['name']}</label></li>";
                                                }else{
                                                    echo "<li><input type='checkbox' class='resourceIdDefault' name='otherInfoId[]' value='{$info['id']}'><label>{$info['name']}</label></li>";    
                                                }                                                                                                
                                            }
                                        }
                                    ?>
                                    <div class="clearfix"></div>
                                    </ul>
                                    </div>
                                </div>
                            </div>
                        </dd>
                        <dt><label>Tiện ích cơ bản</label></dt>
                        <dd>
                            <div class="option-wrapper">
                                <div class="fieldset">
                                    <div class="legend">                                    
                                    <?php                                                               
                                        if($this->estateCheck['baseUtility'] == 1){
                                            echo "<input type='checkbox' name='baseUtility' checked='checked' id='check_all_resource_default'/>";
                                        }else{                                            
                                            echo "<input type='checkbox' name='baseUtility' id='check_all_resource_default'/>";
                                        }
                                    ?>                                        
                                        <label>Chọn</label>
                                    </div>
                                    <div class="fieldset-content">
                                    <ul>
                                    <?php                                         
                                        foreach($this->infoList as $info){
                                            if($info['groupInfo'] == 'baseUtility'){
                                                if($this->estateCheck['baseUtility'] == 1){
                                                    echo "<li><input type='checkbox' disabled='' class='resourceIdDefault' name='resourceId[]' value='{$info['id']}' checked='checked'><label>{$info['name']}</label></li>";
                                                }else{
                                                    echo "<li><input type='checkbox' disabled='' class='resourceIdDefault' name='resourceId[]' value='{$info['id']}'><label>{$info['name']}</label></li>";    
                                                }                                                                                                
                                            }
                                        }
                                    ?>
                                    <div class="clearfix"></div>
                                    </ul>
                                    </div>
                                </div>
                            </div>
                        </dd>
                        
                        <dt><label>Tiện ích khác</label></dt>
                        <dd>
                            <div class="option-wrapper">
                                <div class="fieldset">
                                    <div class="legend">
                                <?php                                                               
                                    if($this->estateCheck['otherUtility'] == 1){
                                        echo "<input type='checkbox' name='otherUtility' checked='checked' id='check_all_resource_default'/>";
                                    }else{
                                        
                                        echo "<input type='checkbox' name='otherUtility' id='check_all_resource_default'/>";
                                    }
                                ?>                                                                            
                                        <label>Chọn</label>
                                    </div>
                                    
                                    <div class="fieldset-content">
                                    <ul>
                                    <?php                                         
                                        foreach($this->infoList as $info){
                                            if($info['groupInfo'] == 'otherUtility'){
                                                if($this->estateCheck['otherUtility'] == 1){
                                                    echo "<li><input type='checkbox' disabled='' class='resourceIdDefault' name='resourceId[]' value='{$info['id']}' checked='checked'><label>{$info['name']}</label></li>";
                                                }else{
                                                    echo "<li><input type='checkbox' disabled='' class='resourceIdDefault' name='resourceId[]' value='{$info['id']}'><label>{$info['name']}</label></li>";    
                                                }                                                                                                
                                            }
                                        }
                                    ?>
                                    <div class="clearfix"></div>
                                    </ul>
                                    </div>
                                </div>
                            </div>
                        </dd>
                       
                        <dd id="submit-element">
                            <input value="Lưu thay đổi" class="button" type="submit" />
                            <input value="Reset" class="button" type="reset"/>
                        </dd>
                    </dl>
                </form>
            </div>
        </div>
    </div>
</div>